#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
    int n; cin >> n;
    vector<int> arr(n);
    for (auto& e : arr) cin >> e;

    int m; cin >> m;
    arr.resize(n + m, 0);

    int i = n;
    while (m--)
    {
        int tmp; cin >> tmp;
        if (find(arr.begin(), arr.begin() + i, tmp) == arr.begin() + i)
            arr[i++] = tmp;
    }
    arr.resize(i);

    int jug = 0;
    for (auto e : arr)
    {
        if (jug)cout << ' '; jug = 1;
        cout << e;
    }

    return 0;
}